<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>众通社云推广后台</title>
	<link rel="stylesheet" type="text/css" href="__PUBLICADMIN__/css/style.css">
</head>
<body>
	<div class="content p50">
		<div class="content-title"><h2>用户添加</h2></div>
		<div class="change">
			<form action="__URL__/editUserForm" method="post" onSubmit="return beforeSubmit(this);">
				<div class="form-group"><span class="form-title">账号：</span><div class="form-text"><input type="text" name="username"></div></div>
				<div class="form-group"><span class="form-title">密码：</span><div class="form-text"><input type="password" name="password"></div></div>
				<div class="form-group"><span class="form-title">确认密码：</span><div class="form-text"><input type="password" name="repassword"></div></div>
				<div class="form-group"><span class="form-title">邮箱：</span><div class="form-text"><input type="text" name="email"></div></div>
				<div class="form-group"><span class="form-title">手机号码：</span><div class="form-text"><input type="text" name="phone"></div></div>
				<div class="form-group"><span class="form-title">钻石：</span><div class="form-text"><input type="number" name="money" value="0" min="0" max="10000"></div></div>
				<div class="form-group">
					<span class="form-title">是否启用：</span>
					<span class="form-radio">是&nbsp; <input type="radio" name="is_apply" value="1" checked></span>
					<span class="form-radio">否&nbsp; <input type="radio" name="is_apply" value="0"></span>
				</div>
				<div class="form-group">
					<span class="form-title">性别：</span>
					<sapn class="form-radio">男&nbsp; <input type="radio" name="sex" value="1" checked></sapn>
					<span class="form-radio">女&nbsp; <input type="radio" name="sex" value="0"></span>					
				</div>
				<div class="form-group">
					<input type="submit" value="提交" class="form-btn">
				</div>
			</form>
		</div>
	</div>
	<include file="Public/ok"/>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-1.7.min.js"></script>
	<script type="text/javascript" src="__PUBLICADMIN__/js/page.js"></script>
	<script type="text/javascript">
		//判断email格式
		function isEmail(str){
			 var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
		     if(re.test(str)){
		        return true;
		     }else{
		        return false;
		     }
		} 
		//判断手机号码
		function isMobile(str){
			if(!str) return false;
			var reg_num = /^\d*$/;	
			if(!reg_num.test(str))	return false;

			return true;
		}
		function beforeSubmit(form){

			if(form.username.value==""){

				prompting('请填写账号！');
				return false;
			}
			
			if(form.password.value==""){
				prompting('请输入密码！');
				return false;
			}
			if(form.password.value!=form.repassword.value){
				prompting('密码与确认密码不一致！');
				return false;
			}

			if(!isEmail(form.email.value)){
				prompting('邮箱格式不正确！');
				return false;
			}
			if(!isMobile(form.phone.value)){
				prompting('手机号码格式不正确');
				return false;
			}

			return true;
		}
	</script>
</body>
</html>